//
//  WPChangPwdViewModel.m
//  ZhongChouPingTai
//
//  Created by WeiPan on 16/4/11.
//  Copyright © 2016年 WPJoe. All rights reserved.
//

#import "WPChangPwdViewModel.h"

@implementation WPChangPwdViewModel
+ (void)changePwdWithCode:(NSString *)code andWithNewPwd:(NSString *)pwd andWithSuccessBlock:(void (^)(NSString *))success andWithFailureBlock:(void (^)(NSString *))failure {
    NSDictionary * params = @{@"mobile":[UserModel defaultUser].phoneNumber,
                              @"newpwd":pwd,
                              @"captcha":code};
    [NetWorkingManager postWithUrl:@"moveSoftware/editLoginPassword.jhtml" requestParams:[NetWorkingManager paramsByAppendingUserInfo:params] SuccessHandler:^(id responseObject) {
        if (responseObject[@"resultType"] && [responseObject[@"resultType"] integerValue]) {
            success(@"修改成功");
        } else {
            failure(responseObject[@"resultMsg"]? responseObject[@"resultMsg"]:@"修改密码失败");
        }
    } failureHandler:^(NSError *error) {
        failure(error.localizedDescription);
    }];
}
@end
